package org.dev.biz_login

import android.content.Context
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.Observer
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.template.IProvider
import org.dev.service_login.ILoginService
import org.dev.service_login.UserProfile


/**
 * Author WenPing
 * CreateTime 2021/8/14.
 * Description:实现service_login中的接口，在该接口中调用具体的方法来获取登录的状态
 */
@Route(path = "/login/service")
class LoginServiceImpl : ILoginService, IProvider {
    override fun login(context: Context?, observer: Observer<Boolean>) {
        AccountManager.login(context, observer)
    }

    override fun isLogin(): Boolean = AccountManager.isLogin()

    override fun getUserProfile(
        lifecycleOwner: LifecycleOwner,
        observer: Observer<UserProfile?>,
        onlyCache: Boolean
    ) {
        AccountManager.getUserProfile(lifecycleOwner, observer, onlyCache)
    }

    override fun getBoardingPass(): String? {
        return AccountManager.getBoardingPass()
    }

    override fun init(context: Context?) {

    }


}